package org.my.spring.agent.mcp.playwright.config;

import org.my.spring.agent.mcp.playwright.service.AutoWebMcpService;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Playwright MCP工具配置类
 * 用于注册Playwright相关的AI工具回调提供者
 */
@Configuration
public class PlaywrightMcpConfig {
    /**
     * 创建AutoWebMcpService的工具回调提供者
     * 将AutoWebMcpService中的@Tool注解方法注册为AI可用工具
     *
     * @param autoWebMcpService Web自动化服务实例
     * @return 工具回调提供者实例
     */
    @Bean
    public ToolCallbackProvider autoWebMcpTools(AutoWebMcpService autoWebMcpService) {
        return MethodToolCallbackProvider.builder().toolObjects(autoWebMcpService).build();
    }
}
